home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / text / edit / Textra16.lha / Textra116 / Scripts / MarkAutodoc.textra < prev    next >
Encoding:
Text File  |  1993-12-17  |  3.7 KB  |  138 lines

  1.     /*******************************************************************
  2.      *      TEXTRA-AREXX script -- Mike Haas, 1993, Public Domain      *
  3.      *                                                                 *
  4.      *      For use with TEXTRA, the GUI-based Amiga Text Editor.      *
  5.      *                                                                 *
  6.      *  If you enhance or write your own Textra scripts, please send   *
  7.      *   to me... especially if you want them added to the package.    *
  8.      *******************************************************************/
  9.  
  10. /*
  11. ** This script is handy for JForth programmers. 
  12. ** It requires at least version 1.15, rexx level 10, of Textra.
  13. ** You can find out your full Textra version by entering into
  14. ** one of the ARexx requester strings:
  15. **
  16. **    @options results;textraversion;notify result
  17. **
  18. ** This script will mark all the functions defined in a
  19. ** standard Commodore-format autodoc.
  20. **
  21. ** This script also requires the bol.textra script, which comes
  22. ** with Textra, to be available (in rexx: or 'launch' current dir)
  23. **
  24. ** Especially useful when assigned to a Textra Function
  25. ** key or CTRL-key macro.
  26. **
  27. ** Mike Haas, Dec 15, 1993
  28. **
  29. ** Freely-distributable for non-commercial purposes.
  30. **
  31. */
  32.  
  33. options results
  34.  
  35. /*check Textra version, must be rexx level 7 at least for MARKSELECT */
  36. rex = 0; result = "NOTSUPPORTED"
  37. address 'TEXTRA' 'textraversion'
  38. parse var result maj min rex
  39. if (result == "NOTSUPPORTED") | (rex < 10) then do
  40.         address 'TEXTRA' 'notify "This version of Textra cannot run this script."'
  41.         exit
  42. end
  43.  
  44. done = 0
  45. libfound = 0
  46.  
  47. gotoxy 0 0
  48.  
  49. find '"TABLE OF CONTENTS"'
  50.  
  51. if result = "OK" then do
  52.     markselect "TABLE OF CONTENTS"
  53.     down 2;bol
  54.     get cursor position;parse var result libnameStart starty
  55.     find '/'
  56.     if result = "OK" then do
  57.         get select position;parse var result libnameEnd endy dummy dummy
  58.         if starty = endy then do
  59.             gotoxy libnameStart starty
  60.             selectto libnameEnd starty
  61.             get select text;parse var result dummy' 'theLibName
  62.             libfound = 1
  63.         end
  64.     end
  65.     else
  66.         exit
  67. end
  68.  
  69. if libfound = 0 then do
  70.     notify "Name of library not found in Table of Contents."
  71.     exit
  72. end
  73.  
  74. do while (done == 0)
  75.     checkcancel; if (result == CANCEL) then exit
  76.     newpage = d2c(12)
  77.     find '"'newpage'"'
  78.     if result == "OK" then  do
  79.         get select position;parse var result dummy dummy npex npey
  80.         gotoxy npex npey
  81.         get cursor char;parse var result thechar
  82.         do while (thechar = ' ') | (thechar = '    ') | (thechar = "-1")
  83.             right 1
  84.             if (rc ~= 0) then
  85.                 exit
  86.             get cursor char;parse var result thechar
  87.         end
  88.         /*
  89.         ** we may be at the beginning of the library name
  90.         */
  91.         get cursor position;parse var result foundStart fsy
  92.         find '/'
  93.         if result = "OK" then do
  94.             get select position;parse var result foundEnd fey funcStart dummy
  95.             if fsy = fey then do
  96.                 /*
  97.                 ** the / character is on the same line
  98.                 */
  99.                 gotoxy foundStart fsy
  100.                 selectto foundEnd fsy
  101.                 get select text;parse var result dummy' 'foundName
  102.                 if foundName = theLibName then do
  103.                     /*
  104.                     ** goto the function name
  105.                     */
  106.                     gotoxy funcStart fey
  107.                     /*
  108.                     ** locate the end of it
  109.                     */
  110. /*
  111.                     hopto next blank;if rc ~= 0 then exit
  112. */
  113.                     get cursor char;parse var result thechar
  114.                     do while ((thechar ~= ' ') & (thechar ~= '    ') & (thechar ~= '(') & (thechar ~= '-1'))
  115.                         right 1
  116.                         if (rc ~= 0) then
  117.                             exit
  118.                         get cursor char;parse var result thechar
  119.                     end
  120.                     get cursor position;parse var result endx dummy
  121.                     left 1
  122.                     do while (thechar ~= '/')
  123.                         left 1
  124.                         get cursor char;parse var result thechar
  125.                     end
  126.                     right 1
  127.                     /*
  128.                     ** and mark it
  129.                     */
  130.                     selectto endx fey
  131.                     get select text;parse var result dummy' 'funcName
  132.                     markselect funcName
  133.                 end
  134.             end
  135.         end
  136.     end
  137. end
  138.